//
// Created by qsy on 2023/8/19.
//

#ifndef CHECK_C8T6_AT24256_H
#define CHECK_C8T6_AT24256_H
#include "main.h"
#define AT24C01     127
#define AT24C02     255
#define AT24C04     511
#define AT24C08     1023
#define AT24C16     2047
#define AT24C32     4095
#define AT24C64     8191
#define AT24C128    16383
#define AT24C256    32767

#define EE_TYPE     AT24C256                                             //EE_TYPE AT24xx的类型，不同的类型这里需要修改宏
//---------------------------------------------------------------------------------------------------------------------------
void at24cxx_init(void);                                                 //初始化函数

uint8_t at24cxx_read_one_byte(uint16_t addr);                            //eeprom内读取一个数据

void at24cxx_write_one_byte(uint16_t addr, uint8_t data);                //写入一个数据进入eeprom

uint8_t at24cxx_check(void);                                             //对eeprom进行读写检查

void at24cxx_read(uint16_t addr, uint8_t *pbuf, uint16_t datalen);       //从eeprom内读取多个数据

void at24cxx_write(uint16_t addr, uint8_t *pbuf, uint16_t datalen);      //写入多个数值进入eeprom

void usart_write_to_eeprom(void);                                        //串口接收数据后写入eeprom

void read_eeprom_data(void);                                             //读取存入eeprom内的校准值
//---------------------------------------------------------------------------------------------------------------------------


#endif //CHECK_C8T6_AT24256_H
